#pragma once

#include "framework.h"
//#include <winnt.h>
//#include <shlwapi.h>
//#include <vector>
#include <winioctl.h>
//#include <pathcch.h>
//#include <stdlib.h>
#include <cstdint>

enum LinkType:uint32_t { Invalid = 0, None = 1, JUNCTION = 2, SYMLINK = 4, SYMLINKD = 8, HardLink = 16, SingleFile = 32, NotSupport = None | SingleFile };
struct SafeHandle {
	HANDLE Handle;
	SafeHandle();
	~SafeHandle();
	bool IsInvalid();
	void ForceClose();
};

typedef struct _REPARSE_DATA_BUFFER {
	DWORD ReparseTag;
	WORD  ReparseDataLength;
	WORD  Reserved;
	union {
		struct {
			WORD SubstituteNameOffset;
			WORD SubstituteNameLength;
			WORD PrintNameOffset;
			WORD PrintNameLength;
			ULONG Flags;
			WCHAR PathBuffer[1];
		} SymbolicLinkReparseBuffer;

		struct {
			WORD SubstituteNameOffset;
			WORD SubstituteNameLength;
			WORD PrintNameOffset;
			WORD PrintNameLength;
			WCHAR PathBuffer[1];
		} MountPointReparseBuffer;

		struct {
			BYTE DataBuffer[1];
		} GenericReparseBuffer;
	};
} REPARSE_DATA_BUFFER;


extern "C" __declspec(dllexport) int32_t __stdcall GetFileLinkCount(LPCWSTR Path, bool IgnorError, int* Error);
extern "C" __declspec(dllexport) LinkType __stdcall GetFileLinkType(LPCWSTR Path, bool IgnorError, int* Error);
extern "C" __declspec(dllexport)  char* __stdcall GetFilelingHardLinks(LPCWSTR Path, bool EnableLength);
